package edu.xlh.travel.dao;

import edu.xlh.travel.pojo.CheckedTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface CheckedTaskDao extends JpaRepository<CheckedTask,String>, JpaSpecificationExecutor<CheckedTask> {
    CheckedTask findByOrderId(String orderId);

    @Transactional
    @Modifying
    @Query(value = "update CheckedTask set delFlag =?2 where orderId =?1")
    void updateCheckedTaskDelFlagByOrderId(String orderId, String delFlag);

    @Transactional
    @Modifying
    @Query(value = "update CheckedTask set delFlag =?2 where id =?1")
    void updateCheckedTaskDelFlagByCheckedTaskId(String taskId, String delFlag);
}
